#349. 两个数组的交集
from typing import List
class Solution:
    def intersection(self, nums1: List[int], nums2: List[int]) -> List[int]:
        #return list(set(nums1) & set(nums2))
        count1=[0]*1001
        count2=[0]*1001
        l=[]

        for i in range(len(nums1)):
            count1[nums1[i]]+=1

        for j in range(len(nums2)):
            count2[nums2[j]]+=1

        for k in range(1001):
            if count1[k]*count2[k]>0:
                l.append(k)

        return l